<template>
  <ul class="menu-list">
    <li class="menu-item flex-a-between bg1">
      <p class="text">全国</p>
      <p class="qg-pre">{{ `${props.nationalActNum}/${props.nationalTargetNum}` }}</p>
    </li>
    <li class="menu-item flex-a-between bg2">
      <p class="text">战区</p>
      <!-- 查看进度按钮 -->
      <div class="lk-btn zq-btn" @click.stop="lookProgress(1)"></div>
      <div class="zq-box" v-show="zqModal" v-click-outside="closeModal">
        <div class="head flex-a">
          <img class="zq-icon" src="@/assets/images/deliver/zq_icon.png" alt="" />
          <p>各战区执行进度</p>
        </div>
        <div class="org-box flex-a">
          <p>全国</p>
          <div class="line-bg">
            <div class="line" :style="{ width: `${props.nationalRate}%` }"></div>
          </div>
          <p>{{ `${props.nationalActNum}/${props.nationalTargetNum}` }}</p>
        </div>
        <ul class="zq-list">
          <li class="zq-item flex-a" v-for="key of Object.keys(props.theaterList)" :key="key">
            <p>{{ key }}</p>
            <div class="line-bg">
              <div class="line" :style="{ width: `${props.theaterList[key].rate}%` }"></div>
            </div>
            <p>{{ `${props.theaterList[key].act_num}/${props.theaterList[key].target_num}` }}</p>
          </li>
        </ul>
      </div>
    </li>
    <li class="menu-item flex-a-between bg3">
      <p class="text">同类</p>
      <!-- 查看进度按钮 -->
      <div class="lk-btn tl-btn" @click.stop="lookProgress(2)">查看进度</div>
      <div class="zq-box" v-show="tlModal" v-click-outside="closeModal">
        <div class="head flex-a">
          <img class="zq-icon" src="@/assets/images/deliver/zq_icon2.png" alt="" />
          <p>同类执行进度</p>
        </div>
        <ul class="tl-list">
          <li class="tl-item flex-a" v-for="key of Object.keys(props.siteTypeList)" :key="key">
            <p>{{ key }}</p>
            <div class="line-bg">
              <div class="line" :style="{ width: `${props.siteTypeList[key].rate}%` }"></div>
            </div>
            <p>{{ `${props.siteTypeList[key].act_num}/${props.siteTypeList[key].target_num}` }}</p>
          </li>
        </ul>
      </div>
    </li>
  </ul>
</template>
<script setup>
import { ref } from 'vue'
const props = defineProps({
  nationalActNum: {
    type: Number,
    default: 0,
  },
  nationalTargetNum: {
    type: Number,
    default: 0,
  },
  theaterList: {
    type: Object,
    default: () => ({}),
  },
  siteTypeList: {
    type: Object,
    default: () => ({}),
  },
})
const zqModal = ref(false)
const tlModal = ref(false)
const lookProgress = (type) => {
  if (type === 1) {
    tlModal.value = false
    zqModal.value = !zqModal.value
  } else {
    zqModal.value = false
    tlModal.value = !tlModal.value
  }
}
const closeModal = () => {
  zqModal.value = false
  tlModal.value = false
}
</script>
<style lang="scss" scoped>
.menu-list {
  position: absolute;
  top: 20px;
  left: 12px;
  z-index: 10;
  .menu-item {
    position: relative;
    padding: 4px 6px 12px 36px;
    width: 160px;
    height: 40px;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 20px;
    line-height: 60px;
    color: #ffffff;
    .qg-pre {
      width: fit-content;
    }
    .zq-box {
      position: absolute;
      top: 0;
      left: 237px;
      width: 461px;
      // height: 252px;
      padding: 10px 0 30px 8px;
      background: rgba($color: #af7b5f, $alpha: 0.8);
      z-index: 10;
      color: #fff;
      font-size: 12px;
      font-weight: 400;
      .head {
        font-weight: bold;
        font-size: 14px;
        color: #f76551;
        margin-bottom: 7px;
        .zq-icon {
          width: 20px;
          height: 20px;
          margin-right: 5px;
        }
      }
      .line-bg {
        position: relative;
        height: 9px;
        margin: 0 6px 0 4px;
        background: rgba(255, 255, 255, 0.6);
        flex: 1;
        .line {
          position: absolute;
          top: 0;
          left: 0;
          width: 50%;
          height: inherit;
        }
      }
      .org-box {
        padding: 0 15px 0 33px;
        .line {
          background: linear-gradient(90deg, #ffd56b 0%, #ed644c 100%);
        }
      }
      .zq-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, 200px);
        gap: 8px 4px;
        padding: 0 15px 0 33px;
        margin-top: 8px;
        .zq-item {
          .line {
            background: linear-gradient(90deg, #ffeccf 0%, #f18977 100%);
          }
        }
      }
      .tl-list {
        padding: 0 30px 0 22px;
        .tl-item {
          margin-bottom: 18px;
          p:first-child {
            width: 48px;
            text-align: right;
          }
        }
        .tl-item:last-child {
          margin-bottom: 0;
        }
        .line-bg {
          margin: 0 12px 0 3px;
        }
        .line {
          background: linear-gradient(90deg, #ffd56b 0%, #ed644c 100%);
        }
      }
    }
  }
  .menu-item:last-child {
    margin-bottom: 0;
  }
  .bg1 {
    background: url('@/assets/images/deliver/menu_1.png') top center no-repeat;
    background-size: 100%;
  }
  .bg2 {
    background: url('@/assets/images/deliver/menu_2.png') top center no-repeat;
    background-size: 100%;
    .lk-btn {
      width: 73px;
      height: 26px;
      background:
        linear-gradient(90deg, #696969 0%, #bdbdbd 100%),
        radial-gradient(
          0% 62% at 67% 62%,
          #f0f0f0 0%,
          rgba(233, 233, 233, 0.5) 30%,
          rgba(0, 0, 0, 0) 100%
        );
      box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.5);
      border-radius: 0px 8px 0px 8px;
      border: 1px solid #d4d4d4;
      cursor: pointer;
      font-size: 12px;
      color: #adadad;
      text-align: center;
      line-height: 26px;
    }
    .zq-btn {
      background-image: url('@/assets/images/deliver/menu_2_btn.png');
      background-size: cover;
    }
    .tl-btn {
      background-image: url('@/assets/images/deliver/menu_3_btn.png');
      background-size: cover;
    }
  }
  .bg3 {
    background: url('@/assets/images/deliver/menu_3.png') top center no-repeat;
    background-size: 100%;
    .lk-btn {
      width: 73px;
      height: 26px;
      background:
        linear-gradient(90deg, #774300 0%, #7c5100 100%),
        radial-gradient(
          0% 62% at 67% 62%,
          #ffe284 0%,
          rgba(255, 204, 0, 0.5) 30%,
          rgba(0, 0, 0, 0) 100%
        );
      box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.5);
      border-radius: 0px 8px 0px 8px;
      border: 1px solid #edc54c;
      cursor: pointer;
      font-size: 12px;
      text-align: center;
      color: #edc54c;
      line-height: 26px;
    }
  }
}
</style>
